package org.onionframework.faces.model;

import javax.persistence.Entity;
import javax.persistence.Table;
import javax.validation.constraints.Max;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.NotBlank;
import org.onionframework.persistence.model.AbstractModel;
import org.onionframework.persistence.model.annotation.DomainModel;

@Entity
@DomainModel
@Table(name="o_faces_food")
public class Food extends AbstractModel {

	private static final long serialVersionUID = 8579295203491529009L;

	private String name;
	private String description;
	private Boolean good;
	private Integer weight;
	private String email;
	
	@NotBlank(message="食物名称不能为空")
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@NotBlank(message="食物说明不能为空")
	@Size(min=5,message="食物说明最少需要{min}个字")
	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@NotNull(message="是否足够好不能为空")
	public Boolean getGood() {
		return this.good;
	}

	public void setGood(Boolean good) {
		this.good = good;
	}

	@Max(value=12,message="重量不能超过12")
	public Integer getWeight() {
		return this.weight;
	}

	public void setWeight(Integer weight) {
		this.weight = weight;
	}

	@Email(message="Email格式不正确")
	public String getEmail() {
		return this.email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	
}
